home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Readers / Gui4Cli / Docs / Tutorials / ChangeArg.gc < prev    next >
Text File  |  1997-12-02  |  3KB  |  138 lines

  1. G4C
  2.  
  3. ; Shows the use of ChangeArg, ChangeGad, SetGad and PartRedraw
  4. ; ------------------------------------------------------------
  5.  
  6.  
  7. WINBIG 179 50 292 148 "ChangeArg.gc"
  8. WinType 11110001
  9.  
  10. BOX 0 0 0 0 OUT button          ; decorative boxes
  11. BOX 10 5 272 63 in button
  12. BOX 10 75 271 69 in button
  13.  
  14.  
  15. ; ------------------------------------------------------------
  16. ;       System events
  17. ; ------------------------------------------------------------
  18.  
  19. xonLoad
  20. GuiOpen ChangeArg.gc
  21.  
  22. xonClose
  23. GuiQuit ChangeArg.gc
  24.  
  25.  
  26. ; ------------------------------------------------------------
  27. ;       The speciment (a button)
  28. ; ------------------------------------------------------------
  29.  
  30. ; The button takes 5 arguments: Left Top Width Height Title
  31. ; These are counted from 0 to 4 (i.e. Left=0.. Title=4)
  32.  
  33. XBUTTON 90 30 120 12 'The Specimen'
  34. gadid 1
  35.  
  36.  
  37. ; ------------------------------------------------------------
  38. ;       The buttons which do the dirty deeds..
  39. ; ------------------------------------------------------------
  40. ; We give gadid's to the buttons because we'll set them on/off
  41. ; when we SHOW/HIDE the "Specimen". Since we do the same to all
  42. ; of them, we give them the same id - No.2
  43.  
  44. ; -------------------
  45.  
  46. XBUTTON 25 80 90 15 'Left'
  47. GadId 2
  48.  
  49.    ; In gadid 1, change arg 0 ('Left') to 30
  50.    ChangeArg ChangeArg.gc 1 0 30
  51.  
  52.    ; The gui must be redrawn for the change to be visible.
  53.    ; We use PartRedraw to Redraw part of the window.
  54.    ; We could have used the Redraw command which will redraw
  55.    ; the full window, but we only change a part of it so no need.
  56.    PartRedraw ChangeArg.gc 11 6 268 55
  57.  
  58. ; -------------------
  59.  
  60. XBUTTON 25 95 90 15 'Top'
  61. GadId 2
  62.  
  63.    ; Change argument number 1 ('top') to 40, and redraw.
  64.    ChangeArg ChangeArg.gc 1 1 40
  65.    PartRedraw ChangeArg.gc 11 6 268 55
  66.  
  67. ; -------------------
  68.  
  69. XBUTTON 25 110 90 15 'Width'
  70. GadId 2
  71.  
  72.    ; change the width to 180
  73.    ChangeArg ChangeArg.gc 1 2 180
  74.    PartRedraw ChangeArg.gc 11 6 268 55
  75.  
  76. ; -------------------
  77.  
  78. XBUTTON 25 125 90 15 'Height'
  79. GadId 2
  80.  
  81.    ; Change argument number 3 ('height') to 16, and redraw.
  82.    ChangeArg ChangeArg.gc 1 3 16
  83.    PartRedraw ChangeArg.gc 11 6 268 55
  84.  
  85. ; -------------------
  86.  
  87. XBUTTON 175 80 90 15 'Title'
  88. GadId 2
  89.  
  90.    ; Change argument number 4 ('title'), and redraw.
  91.    ; Length of new title is padded to length of old.
  92.    ; If new title is to be made longer than the original,
  93.    ; then the original should be padded with spaces to
  94.    ; allow for the extra length.
  95.    ChangeArg ChangeArg.gc 1  4 'New title   '
  96.    PartRedraw ChangeArg.gc 11 6 268 55
  97.  
  98. ; -------------------
  99.  
  100. XBUTTON 175 95 90 15 "Hide"
  101. GadId 2
  102.  
  103.    ; Hide the Specimen button, using SetGad
  104.    SetGad ChangeArg.gc 1 HIDE
  105.    ; and redraw to make gadget disappear
  106.    PartRedraw ChangeArg.gc 11 6 268 55
  107.  
  108.    ; Set all other gadgets off, except the "Show" button
  109.    ; below, forcing the user to turn us back on..
  110.    SetGad ChangeArg.gc 2 OFF
  111.  
  112. ; -------------------
  113.  
  114. XBUTTON 175 110 90 15 "Show"
  115. ; no id here, since we want this gad to always be "on"
  116.  
  117.    ; Show the Specimen button again..
  118.    SetGad ChangeArg.gc 1 SHOW
  119.    PartRedraw ChangeArg.gc 11 6 268 55
  120.  
  121.    ; Set all other gadgets back on
  122.    SetGad ChangeArg.gc 2 ON
  123.  
  124. ; -------------------
  125.  
  126. XBUTTON 175 125 90 15 'RESET'
  127. GadId 2
  128.  
  129.    ; Here we want to change all the gadget's attributes back
  130.    ; to the original, so we use CHANGEGAD to set them all in
  131.    ; one go..
  132.  
  133.    ChangeGad ChangeArg.gc 1 90 30 120 12 'The Specimen'
  134.    PartRedraw ChangeArg.gc 11 6 268 55
  135.  
  136.  
  137.  
  138.